{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import jenkspy\n",
    "'''\n",
    "data类型为dataframe或ndarray类型,包括所有因子以及滑坡标签列\n",
    "label指定滑坡标签列在data中所在的第几列,避免歧义,数据列数从左往右从1开始,列如1,2,3...(没有第0列)例:label=12\n",
    "size_sample为缩小比例,例:size_sample=0.001,即表示缩小到千分之一,缩小比例越小运行速度越快，但不宜太小,断点速度:10000数据1秒\n",
    "break_level为间断点个数,例:break_level=7,7个即表示将数据分为7个区间\n",
    "dispersed为离散型数据所在的列,以列表形式给出,例:dispersed=[3,7,8] or dispersed=[1],没有则不赋值,即不管它\n",
    "注:某些因子的数据集中存在大量的相同的数据,不同数据太少,有时会给缩小数据集带来困难,比如缩小的数据集全为同一个值,这样会导致最终分出的区间少于期望的区间\n",
    "解决办法:扩大size_sample或减小break_level\n",
    "'''\n",
    "class PLB(object):\n",
    "        def __init__(self,data=None,label=None,size_sample=None,break_level=None,dispersed=None):\n",
    "                self.label=label\n",
    "                self.name(data)\n",
    "                self.data=np.array(data)\n",
    "                self.size_sample=size_sample\n",
    "                self.break_level=break_level\n",
    "                self.dispersed=dispersed\n",
    "                self.result=list()\n",
    "                self.assertinit()\n",
    "        def name(self,data):\n",
    "                try:\n",
    "                        self.colmu = list(data.columns)\n",
    "                except:\n",
    "                        self.colmu = [i for i in range(np.array(data).shape[1])]\n",
    "        def assertinit(self):\n",
    "                if self.data is None or self.label == None or self.size_sample == None or self.break_level == None:\n",
    "                        raise Exception('初始化失败，参数不完整')\n",
    "                else:\n",
    "                        pass\n",
    "                if self.data.shape[1] <=self.label:\n",
    "                        pass\n",
    "                else:\n",
    "                        raise Exception('label超出范围')\n",
    "        def ReducedArray(self,array, sample_size_ratio):\n",
    "                numElements = int(sample_size_ratio*len(array))\n",
    "                indices = np.random.permutation(len(array))\n",
    "                if isinstance(numElements, int):\n",
    "                        indices = indices[0:numElements]\n",
    "                else:\n",
    "                        raise TypeError(\"Please ensure the sample size is an integer.\")\n",
    "                \n",
    "                array_short = []\n",
    "                for i in indices:\n",
    "                        array_short.append(array[i])\n",
    "                return np.array(array_short)\n",
    "        def statistics_number(self,breaks_array,col):\n",
    "                condition=breaks_array[0]\n",
    "                block_array=0\n",
    "                data_temporary=self.data[:,col]\n",
    "                max_data_temporary=np.max(data_temporary)\n",
    "                for i in breaks_array[1:]:\n",
    "                        block_array += 1     \n",
    "                        if block_array == self.break_level:\n",
    "                                factors_number=np.sum((data_temporary>=condition) & (data_temporary<=i))\n",
    "                                label_number_index_x=np.where((data_temporary>=condition) & (data_temporary<=i))[0]\n",
    "                                label_number_index_y=np.array([self.label-1 for i in range(len(label_number_index_x))])\n",
    "                                label_number=np.sum(self.data[label_number_index_x,label_number_index_y])\n",
    "                                plb_temporary=float((label_number/self.label_total)/(factors_number/self.total))\n",
    "                                self.result.append(['['+str(condition)+'-'+str(i)+']',factors_number,factors_number/self.total,label_number,label_number/self.label_total,plb_temporary])\n",
    "                                data_temporary[label_number_index_x]=plb_temporary+max_data_temporary+1\n",
    "                                condition = i\n",
    "                        else:\n",
    "                                factors_number=np.sum((data_temporary>=condition) & (data_temporary<i))\n",
    "                                label_number_index_x=np.where((data_temporary>=condition) & (data_temporary<i))[0]\n",
    "                                label_number_index_y=np.array([self.label-1 for i in range(len(label_number_index_x))])\n",
    "                                label_number=np.sum(self.data[label_number_index_x,label_number_index_y])\n",
    "                                plb_temporary=float((label_number/self.label_total)/(factors_number/self.total))\n",
    "                                self.result.append(['['+str(condition)+'-'+str(i)+')',factors_number,factors_number/self.total,label_number,label_number/self.label_total,plb_temporary])\n",
    "                                data_temporary[label_number_index_x]=plb_temporary+max_data_temporary+1\n",
    "                                condition = i\n",
    "                self.data[:,col]=data_temporary-(max_data_temporary+1)\n",
    "        def dispersed_statistics_number(self,break_array,col):\n",
    "                break_array=break_array.tolist()\n",
    "                data_temporary=self.data[:,col]\n",
    "                for i in break_array:\n",
    "                        factors_number=np.sum(data_temporary==i)\n",
    "                        label_number_index_x=np.where(data_temporary==i)[0]\n",
    "                        label_number_index_y=np.array([self.label-1 for i in range(len(label_number_index_x))])\n",
    "                        label_number=np.sum(self.data[label_number_index_x,label_number_index_y])\n",
    "                        plb_temporary=float((label_number/self.label_total)/(factors_number/self.total))\n",
    "                        self.result.append([str(i),factors_number,factors_number/self.total,label_number,label_number/self.label_total,plb_temporary])\n",
    "                        data_temporary[label_number_index_x]=plb_temporary\n",
    "        def random_revise(self,i):\n",
    "                array_short=self.ReducedArray(array=self.data[:,i],sample_size_ratio=self.size_sample)\n",
    "                breaks_array = jenkspy.jenks_breaks(array_short, n_classes=self.break_level)\n",
    "                return breaks_array\n",
    "        def mainprocess(self):\n",
    "                self.total=self.data.shape[0]\n",
    "                self.label_total=np.sum(self.data[:,self.label-1]==1)\n",
    "                for i in range(self.data.shape[1]-1):\n",
    "                        if i == self.label-1:\n",
    "                                pass\n",
    "                        elif self.dispersed is not None and (i+1) in self.dispersed:\n",
    "                                breaks_array=np.unique(self.data[:,i])\n",
    "                                self.result.append([self.colmu[i]+'离散型','因子栅格','因子栅格比例','滑坡栅格','滑坡栅格比例','频率比'])\n",
    "                                self.dispersed_statistics_number(breaks_array,i)\n",
    "                        else:\n",
    "                                breaks_array = self.random_revise(i)\n",
    "                                for j in range(50):\n",
    "                                        if len(np.unique(breaks_array)) != self.break_level+1:\n",
    "                                                breaks_array = self.random_revise(i)\n",
    "                                        else:\n",
    "                                                break\n",
    "                                break_temporary=np.unique(breaks_array)\n",
    "                                if len(break_temporary) == 1:\n",
    "                                        breaks_array=[np.min(self.data[:,i]),+np.max(self.data[:,i])]\n",
    "                                else:\n",
    "                                        breaks_array=break_temporary.tolist()\n",
    "                                        breaks_array[0]=np.min(self.data[:,i])\n",
    "                                        breaks_array[-1]=np.max(self.data[:,i])\n",
    "                                self.result.append([self.colmu[i]+'连续型','因子栅格','因子栅格比例','滑坡栅格','滑坡栅格比例','频率比'])\n",
    "                                self.statistics_number(breaks_array,i)\n",
    "        #path:存储绝对路径\n",
    "        def save_data_list(self,path):\n",
    "                if len(self.result) >= 1:\n",
    "                        pd.DataFrame(self.result).to_excel(path,index=False,header=False)\n",
    "                else:\n",
    "                        raise Exception('No data or no training or path error')\n",
    "        def save_data(self,path):\n",
    "                if len(self.result) >= 1:\n",
    "                        if isinstance(self.colmu[0], int):\n",
    "                                pd.DataFrame(self.data).to_csv(path,index=False,header=False)\n",
    "                        else:\n",
    "                                pd.DataFrame(self.data).to_csv(path,index=False,header=self.colmu)\n",
    "                else:\n",
    "                        raise Exception('No data or no training or path error')\n",
    "        def show_data(self):\n",
    "                if len(self.result) >= 1:\n",
    "                        return self.result\n",
    "                else:\n",
    "                        raise Exception('No data or no training')\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DEMMEAN</th>\n",
       "      <th>DEMSTD</th>\n",
       "      <th>DEMRANGE</th>\n",
       "      <th>PDSTD</th>\n",
       "      <th>PDMEAN</th>\n",
       "      <th>PDRANGE</th>\n",
       "      <th>CCDMEAN</th>\n",
       "      <th>CCDSTD</th>\n",
       "      <th>CCDRANGE</th>\n",
       "      <th>HPDMDMEAN</th>\n",
       "      <th>...</th>\n",
       "      <th>RKMDRANGE</th>\n",
       "      <th>RKMDSTD</th>\n",
       "      <th>ZFSMEAN</th>\n",
       "      <th>ZFSSTD</th>\n",
       "      <th>ZFSRANGE</th>\n",
       "      <th>YX</th>\n",
       "      <th>TRLX</th>\n",
       "      <th>PX</th>\n",
       "      <th>PW</th>\n",
       "      <th>ID</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1657.407471</td>\n",
       "      <td>19.156695</td>\n",
       "      <td>68.228394</td>\n",
       "      <td>6.892178</td>\n",
       "      <td>18.587369</td>\n",
       "      <td>25.665127</td>\n",
       "      <td>1.064478</td>\n",
       "      <td>0.043749</td>\n",
       "      <td>0.154391</td>\n",
       "      <td>0.019894</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>227.840000</td>\n",
       "      <td>5.808132</td>\n",
       "      <td>22</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1637.819214</td>\n",
       "      <td>9.903728</td>\n",
       "      <td>35.001831</td>\n",
       "      <td>6.366074</td>\n",
       "      <td>14.898681</td>\n",
       "      <td>21.245491</td>\n",
       "      <td>1.042144</td>\n",
       "      <td>0.031483</td>\n",
       "      <td>0.099025</td>\n",
       "      <td>0.019894</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>239.400000</td>\n",
       "      <td>2.289105</td>\n",
       "      <td>7</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1658.950253</td>\n",
       "      <td>16.267200</td>\n",
       "      <td>63.161255</td>\n",
       "      <td>6.748956</td>\n",
       "      <td>20.545227</td>\n",
       "      <td>23.681781</td>\n",
       "      <td>1.077615</td>\n",
       "      <td>0.049941</td>\n",
       "      <td>0.178404</td>\n",
       "      <td>0.019894</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>238.315789</td>\n",
       "      <td>2.636837</td>\n",
       "      <td>7</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1626.370275</td>\n",
       "      <td>21.851113</td>\n",
       "      <td>84.671265</td>\n",
       "      <td>4.101825</td>\n",
       "      <td>23.316947</td>\n",
       "      <td>17.118373</td>\n",
       "      <td>1.092733</td>\n",
       "      <td>0.033019</td>\n",
       "      <td>0.138064</td>\n",
       "      <td>0.019894</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>237.238095</td>\n",
       "      <td>1.191428</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1636.324336</td>\n",
       "      <td>31.323637</td>\n",
       "      <td>114.594482</td>\n",
       "      <td>6.045970</td>\n",
       "      <td>26.949860</td>\n",
       "      <td>22.944965</td>\n",
       "      <td>1.130788</td>\n",
       "      <td>0.053524</td>\n",
       "      <td>0.203952</td>\n",
       "      <td>0.019894</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>237.576923</td>\n",
       "      <td>1.924999</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>471127</th>\n",
       "      <td>42.559901</td>\n",
       "      <td>22.964064</td>\n",
       "      <td>81.465805</td>\n",
       "      <td>7.612681</td>\n",
       "      <td>19.136541</td>\n",
       "      <td>31.755004</td>\n",
       "      <td>1.070504</td>\n",
       "      <td>0.054401</td>\n",
       "      <td>0.195880</td>\n",
       "      <td>0.054710</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>233.896552</td>\n",
       "      <td>9.071915</td>\n",
       "      <td>30</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>471128</th>\n",
       "      <td>31.544918</td>\n",
       "      <td>8.334303</td>\n",
       "      <td>33.878940</td>\n",
       "      <td>3.911953</td>\n",
       "      <td>9.513686</td>\n",
       "      <td>15.104400</td>\n",
       "      <td>1.016448</td>\n",
       "      <td>0.011721</td>\n",
       "      <td>0.044463</td>\n",
       "      <td>0.054710</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>227.088889</td>\n",
       "      <td>11.403357</td>\n",
       "      <td>37</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>471129</th>\n",
       "      <td>49.468807</td>\n",
       "      <td>6.860040</td>\n",
       "      <td>20.513451</td>\n",
       "      <td>4.313732</td>\n",
       "      <td>11.282226</td>\n",
       "      <td>16.337152</td>\n",
       "      <td>1.022826</td>\n",
       "      <td>0.015141</td>\n",
       "      <td>0.054531</td>\n",
       "      <td>0.054710</td>\n",
       "      <td>...</td>\n",
       "      <td>320.150635</td>\n",
       "      <td>124.958755</td>\n",
       "      <td>241.250000</td>\n",
       "      <td>8.926786</td>\n",
       "      <td>33</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>471130</th>\n",
       "      <td>38.078359</td>\n",
       "      <td>4.506623</td>\n",
       "      <td>15.901793</td>\n",
       "      <td>4.136177</td>\n",
       "      <td>6.006325</td>\n",
       "      <td>13.745064</td>\n",
       "      <td>1.008283</td>\n",
       "      <td>0.012553</td>\n",
       "      <td>0.042151</td>\n",
       "      <td>0.054710</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>248.800000</td>\n",
       "      <td>4.664762</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>471131</th>\n",
       "      <td>31.138672</td>\n",
       "      <td>8.775472</td>\n",
       "      <td>22.036531</td>\n",
       "      <td>5.533137</td>\n",
       "      <td>11.207734</td>\n",
       "      <td>14.187987</td>\n",
       "      <td>1.024559</td>\n",
       "      <td>0.018624</td>\n",
       "      <td>0.048678</td>\n",
       "      <td>0.054710</td>\n",
       "      <td>...</td>\n",
       "      <td>320.150635</td>\n",
       "      <td>119.313097</td>\n",
       "      <td>252.833333</td>\n",
       "      <td>1.142609</td>\n",
       "      <td>4</td>\n",
       "      <td>7</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>471132 rows × 65 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            DEMMEAN     DEMSTD    DEMRANGE     PDSTD     PDMEAN    PDRANGE  \\\n",
       "0       1657.407471  19.156695   68.228394  6.892178  18.587369  25.665127   \n",
       "1       1637.819214   9.903728   35.001831  6.366074  14.898681  21.245491   \n",
       "2       1658.950253  16.267200   63.161255  6.748956  20.545227  23.681781   \n",
       "3       1626.370275  21.851113   84.671265  4.101825  23.316947  17.118373   \n",
       "4       1636.324336  31.323637  114.594482  6.045970  26.949860  22.944965   \n",
       "...             ...        ...         ...       ...        ...        ...   \n",
       "471127    42.559901  22.964064   81.465805  7.612681  19.136541  31.755004   \n",
       "471128    31.544918   8.334303   33.878940  3.911953   9.513686  15.104400   \n",
       "471129    49.468807   6.860040   20.513451  4.313732  11.282226  16.337152   \n",
       "471130    38.078359   4.506623   15.901793  4.136177   6.006325  13.745064   \n",
       "471131    31.138672   8.775472   22.036531  5.533137  11.207734  14.187987   \n",
       "\n",
       "         CCDMEAN    CCDSTD  CCDRANGE  HPDMDMEAN  ...   RKMDRANGE     RKMDSTD  \\\n",
       "0       1.064478  0.043749  0.154391   0.019894  ...    0.000000    0.000000   \n",
       "1       1.042144  0.031483  0.099025   0.019894  ...    0.000000    0.000000   \n",
       "2       1.077615  0.049941  0.178404   0.019894  ...    0.000000    0.000000   \n",
       "3       1.092733  0.033019  0.138064   0.019894  ...    0.000000    0.000000   \n",
       "4       1.130788  0.053524  0.203952   0.019894  ...    0.000000    0.000000   \n",
       "...          ...       ...       ...        ...  ...         ...         ...   \n",
       "471127  1.070504  0.054401  0.195880   0.054710  ...    0.000000    0.000000   \n",
       "471128  1.016448  0.011721  0.044463   0.054710  ...    0.000000    0.000000   \n",
       "471129  1.022826  0.015141  0.054531   0.054710  ...  320.150635  124.958755   \n",
       "471130  1.008283  0.012553  0.042151   0.054710  ...    0.000000    0.000000   \n",
       "471131  1.024559  0.018624  0.048678   0.054710  ...  320.150635  119.313097   \n",
       "\n",
       "           ZFSMEAN     ZFSSTD  ZFSRANGE  YX  TRLX  PX  PW  ID  \n",
       "0       227.840000   5.808132        22   5     5   1   2   0  \n",
       "1       239.400000   2.289105         7   5     5   1   2   0  \n",
       "2       238.315789   2.636837         7   5     5   2   2   0  \n",
       "3       237.238095   1.191428         3   5     5   1   2   0  \n",
       "4       237.576923   1.924999         6   5     5   2   2   0  \n",
       "...            ...        ...       ...  ..   ...  ..  ..  ..  \n",
       "471127  233.896552   9.071915        30   0     4   2   1   0  \n",
       "471128  227.088889  11.403357        37   0     4   2   2   0  \n",
       "471129  241.250000   8.926786        33   3     4   2   2   0  \n",
       "471130  248.800000   4.664762        14   0     4   2   2   0  \n",
       "471131  252.833333   1.142609         4   7     4   3   1   0  \n",
       "\n",
       "[471132 rows x 65 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data=pd.read_csv(r'E:\\微信文件管理\\WeChat Files\\wxid_a8eoqssp3wci22\\FileStorage\\File\\2023-03\\20230304quanqu.csv')\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "#dispersed=[60,61,62,63,64]选择离散型数据列\n",
    "fft=PLB(data=data,label=65,size_sample=0.001,break_level=8,dispersed=[60,61,62,63,64])\n",
    "#开始计算\n",
    "fft.mainprocess()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "#保存因子频率比清单\n",
    "fft.save_data_list(r'E:\\微信文件管理\\WeChat Files\\wxid_a8eoqssp3wci22\\FileStorage\\File\\2023-03\\因子频率比清单.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "#数据量一般较大，故save_data()函数保存csv格式数据\n",
    "#保存因子频率比，已替换\n",
    "fft.save_data(r'E:\\微信文件管理\\WeChat Files\\wxid_a8eoqssp3wci22\\FileStorage\\File\\2023-03\\因子频率比.csv')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "development",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.18"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
